import request from '@/config/axios'

export interface CategoryRespVO {
  id: number
  name: string
  icon?: string
  description?: string
  language: string
  sortOrder: number
  isActive: boolean
  createTime: string
  updateTime: string
}

export interface CategoryPageReqVO extends PageParam {
  name?: string
  language?: string
  isActive?: boolean
}

// 获取分类列表
export const getCategoryList = (language?: string) => {
  return request.get({
    url: '/reading/admin/categories/list',
    params: { language }
  })
}

// 获取分类分页
export const getCategoryPage = (params: CategoryPageReqVO) => {
  return request.get({
    url: '/reading/admin/categories/page',
    params
  })
}

// 获取分类详情
export const getCategory = (id: number) => {
  return request.get({
    url: '/reading/admin/categories/get',
    params: { id }
  })
}

// 获取启用的分类列表（用于下拉选择）
export const getActiveCategoryList = (language?: string) => {
  return request.get({
    url: '/reading/admin/categories/list',
    params: { language }
  })
}
